package com.cskaoyan.order.biz.handler;
import com.cskaoyan.order.biz.context.AbsTransHandlerContext;
import com.cskaoyan.order.biz.context.TransHandlerContext;
import com.cskaoyan.order.mq.provider.DelayCancelProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * @Description: 利用mq发送延迟取消订单消息
 **/
@Component
@Slf4j
public class SendMessageHandler extends AbstractTransHandler {


	@Autowired
	DelayCancelProvider provider;

	@Override
	public boolean isAsync() {
		return false;
	}

	@Override
	public boolean handle(TransHandlerContext context) {

		AbsTransHandlerContext context1 = (AbsTransHandlerContext) context;
		provider.sendDelayMessage(context1.getOrderId());
		// 发送延迟消息即可

		// 调用一个方法实现延迟消息的发送
		return true;
	}
}